<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Admin extends CI_Controller {

	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function loadview()
	{

		date_default_timezone_set('Asia/Calcutta');
		$page_id = $this->uri->segment(3, 0);
		$data['page_id']=$page_id;
		$this->load->view('header');
		$this->load->view('site-header');
		$this->load->view('one-col',$data);
		$this->load->view('footer');
	}

	public function view(){

		if (!$this->tank_auth->is_logged_in()) {
			redirect('/auth/login/');
		} else {

			$data=array();
			$data['user_id']	= $this->tank_auth->get_user_id();
			$data['username']	= $this->tank_auth->get_username();
			$this->session->set_userdata('orgid',$data['user_id']);

			//Get the page id and pass it to the view.
			date_default_timezone_set('Asia/Calcutta');
			$page_id = $this->uri->segment(3, 0);
			$data['page_id']=$page_id;

			$this->load->view('admin/dashboard',$data);
		}

	}

	public function loadtab(){
		$tab = $this->uri->segment(3, 0);
		switch($tab){
			case 'customizer':
				$this->load->view('admin/guicustomizer');
				break;
			case 'mngobjs':
				$this->load->view('admin/manageobjects');
				break;
			case 'catalog':
				$this->load->view('admin/catalog');
				break;
			case 'websvcs':
				$this->load->view('admin/defaultwebservices');
				break;
			case 'cwebsvcs':
				$this->load->view('admin/customwebsvcs');
				break;
			case 'workflow':
				$this->load->view('admin/workflow');
				break;
			case 'inventory':
				$this->load->view('admin/inventory');
				break;
			case 'sidelinks':
				$this->load->view('admin/sidelinks');
				break;

			case 'welcome':
				$this->load->view('admin/welcome');
				break;
		}
	}
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */
